package day15;

import day4.BankAcc;

import java.util.*;

/**
 * @author oldliu
 * @since 1.0
 */
public class ToJson {
    public static void main(String[] args) {
        List<BankAcc> list = new ArrayList<>();
        list.add(new BankAcc("hf--1", "老吴", "123", "shanghai", 1000000.0F));
        list.add(new BankAcc("hf--2", "小刘", "1243", "shanghai", 100030.0F));
        list.add(new BankAcc("hf--3", "小李", "1523", "nanjing", 60000.0F));
        list.add(new BankAcc("hf--4", "老张", "623", "shanghai", 1000.0F));
        list.add(new BankAcc("hf--3", "小马", "282938282", "安庆", 7676666.0F));


        StringBuilder sb = new StringBuilder();
        sb.append("[");
        for (int i = 0; i < list.size(); i++) {
            BankAcc b = list.get(i);
            sb.append("{");
            sb.append("\"no\":\"" + b.getNo() + "\"");
            sb.append(",\"money\":" + b.getMoney() + "");
            sb.append("}");
            if (i < list.size() - 1)
                sb.append(",");
        }
        sb.append("]");
        System.out.println(sb);
    }
}
